#include<iostream>
using namespace std;

class Account
{
private:
    int balance;
    float rate;
    char type;
    long long num;    
public:
    Account(){};
    Account(long long _num,char _type,int _balance)
    {
        num=_num;
        type=_type;
        balance=_balance;
        rate=0.005;
    }
    Account(const Account &p)
    {
        num=p.num+50000000;
        type=p.type;
        rate=0.015;
        balance=p.balance;
    }
    void find()
    {
        cout<<"Account="<<num;
        if(type=='P')
        {
        cout<<"--Person--sum="<<balance<<"--rate="<<rate<<endl;
        }else
        {
            cout<<"--Enterprise--sum="<<balance<<"--rate="<<rate<<endl;
        }
    }
    void add()
    {
        balance+=balance*rate;
        cout<<"Account="<<num<<"--sum="<<balance<<endl;
    }
};


int main()
{
    long long num;
    char type,_type;
    int balance;
    int t;
    cin>>t;
    while(t--)
    {
        cin>>num>>type>>balance;
        Account p1(num,type,balance);
        Account p2=Account(p1);
        cin>>_type;
        if(_type=='C')
        {
            p1.add();
        }else
        {
            p1.find();
        }
        cin>>_type;
        if(_type=='C')
        {
            p2.add();
        }else
        {
            p2.find();
        }
    }
    return 0;
}